package com.eveinfo.api.utils.certificates;

import java.io.IOException;

import javax.xml.parsers.ParserConfigurationException;

import org.xml.sax.SAXException;

import com.eveinfo.api.AbstractApiParser;
import com.eveinfo.api.ApiException;
import com.eveinfo.api.NoCacheFoundExecption;

public class CertificatesParser extends AbstractApiParser<CertificatesResponse,CertificatesHandler> {
	private static final String URL = "/eve/CertificateTree.xml.aspx";

	private static CertificatesParser instance;
	
	public static CertificatesParser getInstance(){
		if(instance == null){
			instance = new CertificatesParser();
		}
		return instance;
	}
	
	private CertificatesParser() {
		super(CertificatesResponse.class, 2, URL);
	}

	public CertificatesResponse getCertificates() throws IOException, SAXException, ParserConfigurationException,
			ApiException, NoCacheFoundExecption {
		CertificatesHandler handler = new CertificatesHandler();
		return getResponse(handler);
	}

	public static boolean isInstancier() {
		return instance != null;
	}

}